package com.lyz.moil.core.security.entity;


import com.lyz.moil.core.orm.hibernate.BaseEntity;

import javax.persistence.*;
import java.util.Set;

/**
 * Created with IntelliJ IDEA.
 * User: xi
 * Date: 13-11-18
 * Time: 下午4:52
 * To change this template use File | Settings | File Templates.
 */
@Entity
public class Department extends BaseEntity {

    private String name;

    @ManyToOne(cascade = CascadeType.PERSIST)
    @JoinColumn(name = "parent_id", nullable = true)
    private Department parent;

    private String memo;

    private String address;

    private String zipCode;

    private String code;

    @ManyToOne(cascade = CascadeType.PERSIST)
    @JoinColumn(name = "type_id", nullable = true)
    private DepartmentType type;

    @OneToMany(mappedBy = "department", cascade = CascadeType.ALL)
    private Set<LinkMan> contacts;

    @Transient
    private LinkMan[] linkMans;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Department getParent() {
        return parent;
    }

    public void setParent(Department parent) {
        this.parent = parent;
    }

    public String getMemo() {
        return memo;
    }

    public void setMemo(String memo) {
        this.memo = memo;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getZipCode() {
        return zipCode;
    }

    public void setZipCode(String zipCode) {
        this.zipCode = zipCode;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public Set<LinkMan> getContacts() {
        return contacts;
    }

    public void setContacts(Set<LinkMan> contacts) {
        this.contacts = contacts;
    }

    public DepartmentType getType() {
        return type;
    }

    public void setType(DepartmentType type) {
        this.type = type;
    }

    public LinkMan[] getLinkMans() {
        return linkMans;
    }

    public void setLinkMans(LinkMan[] linkMans) {
        this.linkMans = linkMans;
    }
}
